from django.db import models


# Create your models here.


class Category(models.Model):
    cname = models.CharField(max_length=100)

    def __str__(self):
        return self.cname


class Goods(models.Model):
    gname = models.CharField(max_length=100)
    gdesc = models.CharField(max_length=100)
    oldprice = models.DecimalField(max_digits=5, decimal_places=2)
    price = models.DecimalField(max_digits=5, decimal_places=2)
    category = models.ForeignKey(Category, on_delete=models.CASCADE)

    def __str__(self):
        return self.gname


class GoodsDetailName(models.Model):
    gdname = models.CharField(max_length=100)

    def __str__(self):
        return self.gdname
class GoodsDetail(models.Model):
    gdurl=models.ImageField(upload_to="")
